//
//  LoginViewController.m
//  人人播
//
//  Created by Geek on 15/6/2.
//  Copyright (c) 2015年 Geek. All rights reserved.
//

#import "LoginViewController.h"
#import "IndexViewController.h"
#import "SonViewController.h"
#import "MMDrawerController.h"
#import "MMExampleDrawerVisualStateManager.h"
#import "RegisterViewController.h"
@interface LoginViewController () <UITextFieldDelegate>
{

    MMDrawerController *_drawer;

}
@end

@implementation LoginViewController
- (void) viewWillAppear:(BOOL)animated{
    
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = YES;//隐藏导航栏
    
    
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
   self.title = @"登陆";
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


// 输入手机号文本框
- (IBAction)phoneNumberTextField:(UITextField *)sender {
}

// 登录密码文本框
- (IBAction)passwordTextField:(UITextField *)sender {
}

// 登陆按钮
- (IBAction)loginButton:(UIButton *)sender {
    
  UIWindow *window = [UIApplication sharedApplication].keyWindow;
        IndexViewController *indexVc = [[IndexViewController alloc] init];
        SonViewController *sonVc = [[SonViewController alloc] init];
    
        //使用MMDraw框架  布局左中右三块视图
        _drawer = [[MMDrawerController alloc] initWithCenterViewController:indexVc leftDrawerViewController:sonVc ];
    
        //设置左、右两边滑动的宽度
        _drawer.maximumLeftDrawerWidth = 80;
        _drawer.maximumRightDrawerWidth = 200;
    
    
        // 设置打开关闭区域以及是否需要各种手势
        [_drawer setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
        [_drawer setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];
    
    
    
        //设置动画效果
        [[MMExampleDrawerVisualStateManager sharedManager] setLeftDrawerAnimationType:MMDrawerAnimationTypeSlide];
  
        // 配置管理动画
        [_drawer setDrawerVisualStateBlock:^(MMDrawerController *drawerController, MMDrawerSide drawerSide, CGFloat percentVisible) {
    
            MMDrawerControllerDrawerVisualStateBlock block;
    
            block = [[MMExampleDrawerVisualStateManager sharedManager]
                     drawerVisualStateBlockForDrawerSide:drawerSide];
            if(block){
                block(drawerController, drawerSide, percentVisible);
            }
        }];
        
        
        window.rootViewController = _drawer;
    
    UIView *view = [[UIView alloc] init];
    view.backgroundColor = [UIColor greenColor];
    view.frame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height - 49, [UIScreen mainScreen].bounds.size.width, 49);
    [_drawer.view addSubview:view];
}

// 注册按钮
- (IBAction)registerButton:(UIButton *)sender {
    
    UIStoryboard *story = [UIStoryboard storyboardWithName:@"RegisterViewController" bundle:nil];
    RegisterViewController *registerVc = [story instantiateInitialViewController];
    [self.navigationController pushViewController:registerVc animated:YES];
    
    
}

// 忘记密码按钮
- (IBAction)forgetPasswordButton:(UIButton *)sender {
}

// 取消键盘
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self.view endEditing:YES];
}

@end
